﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using MediaInfoLib;

namespace Cataloger
{
    public class PluginAudioWideo
    {
        public static string GetOpis(FileInfo fi)
        {
            StringBuilder st = new StringBuilder();
            MP3Header mp3 = new MP3Header();
            
            mp3.ReadMP3Information(fi.FullName);
            st.AppendLine("Bitrate: \t" + mp3.intBitRate.ToString()+ " kbps");
            st.AppendLine("Freq: \t" + mp3.intFrequency.ToString()+ " Hz");
            st.AppendLine("Tryb: \t" + mp3.strMode.ToString());
            st.AppendLine("Długość: \t" + mp3.strLengthFormatted.ToString());
            return st.ToString();

        }
        public static string GetOpis2(FileInfo fi)
        {
            TagLib.File file = TagLib.File.Create(fi.FullName);
            StringBuilder st = new StringBuilder();
            st.AppendLine("Bitrate: \t" + file.Properties.AudioBitrate+" kbps");
            st.AppendLine("Freq: \t" + file.Properties.AudioSampleRate+" Hz");
            st.AppendLine("Kanały: \t" + file.Properties.AudioChannels);
            st.AppendLine("Dlugosc: \t" + file.Properties.Duration);
            //st.AppendLine("Typ: \t" + file.Properties.MediaTypes);
            //try
            //{
            //    st.AppendLine("Wymiary: \t" + file.Properties.VideoHeight + " : " + file.Properties.VideoWidth);
            //}
            //catch { }
            

            return st.ToString();
        }
        public static string GetOpis3(FileInfo fi)
        {
            String opis = "";
            MediaInfo MI = new MediaInfo();

            

            MI.Open(fi.FullName);

            MI.Option("Complete");
            opis += MI.Inform();



            MI.Close();
            return opis;
        }
    }
}
